#ifndef INCL_FIRST_H
#define INCL_FIRST_H

#include <iostream>


struct Run
{
	Run(int code):code(code){};
	virtual ~Run(){};
	virtual void prestate() = 0;
	virtual void state() = 0;
	virtual void poststate() = 0;
	int getCode(){return code;};

private:
	int code;
};

struct Proc
{
	virtual ~Proc(){};
	virtual void run(Run* p)
	{
		std::cout<<"code  is "<<p->getCode()<<std::endl;
		p->prestate();
		p->state();
		p->poststate();
	}


};


struct Run1 : Run
{
	Run1():Run(1){};
private:
	void prestate()
	{
		std::cout<<"prestate"<<std::endl;
	}
	void state()
	{
	    std::cout<<"prestate1"<<std::endl;
	}
	void poststate()
	{
		std::cout<<"prestate1"<<std::endl;
	}
};

struct Run2 : Run
{
	Run2():Run(2){};
private:
	void prestate()
	{
		std::cout<<"prestate"<<std::endl;
	}
	void state()
	{
	    std::cout<<"pres2"<<std::endl;
	}
	void poststate()
	{
		std::cout<<"prest2"<<std::endl;
	}
};







#endif
